package com.seal.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.seal.comm.utils.Page;
import com.seal.dao.IBrandDao;
import com.seal.dto.BrandDto;
import com.seal.model.Brand;
import com.seal.service.IBrandService;

@Service("brandServiceImpl")
@Transactional(readOnly = true)
public class BrandServiceImpl implements IBrandService{
	@Resource(name= "brandDaoImpl")
	private IBrandDao brandDao;

	@Transactional(propagation = Propagation.REQUIRED,readOnly = false,rollbackForClassName="Exception")
	public void addBrand(Brand ca) throws Exception {
		brandDao.addBrand(ca);
	}

	@Transactional(propagation = Propagation.REQUIRED,readOnly = false,rollbackForClassName="Exception")
	public void deleteBrand(Brand ca) throws Exception {
		brandDao.deleteBrand(ca);
	}

	public List<Brand> getAllBrand(BrandDto brandDto, Page page) throws Exception {
		return brandDao.getAllBrand(brandDto, page);
	}

	public Brand getBrandById(Long id) throws Exception {
		return brandDao.getBrandById(id);
	}

	@Transactional(propagation = Propagation.REQUIRED,readOnly = false,rollbackForClassName="Exception")
	public void updateBrand(Brand ca) throws Exception {
		brandDao.updateBrand(ca);
	}	
	
}
